package pl.edu.agh.sao.engine;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;


/**
 * Immutable class for Point.
 * 
 * @author Jerzy
 */
public final class Point {

	private final int x;
	private final int y;
	
	private Point(int x, int y) {
		this.x = x;
		this.y = y;
	}
	
	public static final Point of(int x, int y) {
		return new Point(x, y);
	}
	
	public int getX() {
		return x;
	}
	
	public int getY() {
		return y;
	}
	
	@Override
	public String toString() {
		return String.format("(%d, %d)", x, y);
	}
	
	@Override
	public boolean equals(Object obj) {
	   return EqualsBuilder.reflectionEquals(this, obj);
	}
	
	@Override
	public int hashCode() {
	   return HashCodeBuilder.reflectionHashCode(this);
	}
}
